#-*- coding: utf8 -*-
from tutor.script import *
from tutor.plugin.maple import *

# variáveis úteis
half = M('1/2')
t = M.t
_i, _j, _k = M('_i, _j, _k')
rr = M('`..`')
coeff = M.coeff

# parâmetros iniciais
a = M(oneof(-2, -1, -1, 1, 1, 2, 3))
b = M(oneof(-2, -1, 1, 1, 2, 3))
c = M(oneof(-2, -1, 1, 1, 2, 3))
d = M(oneof(-2, -1, 1, 1, 2, 3))

# campo
A = fieldA = (b * x ** 2) * _i + \
             (a * x * z + c * y ** 3) * _j + \
             (d * z) * _k

# --- resultados --------------------------------------------------------------
print('campoA: %s' % A)

# correto 
campoB = -a * x * _i + a * z * _k
campoBS = -campoB
print('campoB: %s' % campoB)

# erros
campoB2 = a * x * _i + a * z * _k
campoBS2 = -campoB2
print('campoB2: %s' % campoB2)

# divergente 
divergente = 2 * b * x * _i + 3 * c * y ** 2 * _j + d * _k
divergenteS = -divergente
print('divergente: %s' % divergente)

# --- fluxos -------------------------------------------------------------------
fluxo = Pi * a
fluxoGauss = c * Pi / 4
fluxoGauss2 = b * Pi / 12 + d * Pi / 3
